-
Notifications
You must be signed in to change notification settings - Fork 2
feat(mcms): add chain access adapter #672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
chain/adapters/mcms/chain_access.go
Outdated
|
|
||
| // ChainAccess adapts CLDF's chain.BlockChains into a selector + lookup style API. | ||
| // It used to make compatible with mcms lib chain access interface. | ||
| type ChainAccess struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I would prefer to call this an Adapter in the name to make it clear what it is doing.
So if ChainAccess is the name of the interface you are adapting to then ChainAccessAdapter
chain/adapters/mcms/chain_access.go
Outdated
| @@ -0,0 +1,67 @@ | |||
| package mcms | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should flip this around and make this chains/mcms/adapter with the package name adapter
The mcms package name is kinda overloaded now
In order to be able to abstract away inspectors and timelock converter builders into mcms lib, we've defined a set of new interfaces for chain access that allow mcmslib to access the blockchain without directly depending on CLDF. This PR create the adapter for CLDF chains to comply with the mcms lib interfaces, which will be used in mcms-tools and several of the CLD composite Go Actions related to mcms.
AI Summary
This pull request introduces a new adapter,
ChainAccess, to themcmspackage, providing a unified interface for accessing multiple blockchain clients (EVM, Solana, Aptos, Sui) via chain selectors. It also adds comprehensive unit tests to ensure correct behavior for both known and unknown selectors.New adapter implementation:
chain/adapters/mcms/chain_access.go, which implements theChainAccessstruct to adapt CLDF'sBlockChainsinto a selector-based lookup API, supporting EVM, Solana, Aptos, and Sui clients.Testing:
chain/adapters/mcms/chain_access_test.gowith tests for handling unknown selectors and verifying correct client/signature retrieval for each supported chain type.